Block operation method, electronic device, and storage medium

ABSTRACT

A block operation method, an electronic device, and a storage medium are provided. A plurality of clusters are calculated according to computing power and rewards of each blockchain node, a node computing power and reward carried by each broadcast block being determined when a blockchain node receives a broadcast block. A target cluster to which a blockchain node belongs is determined, and a target difficulty weighting is determined, corresponding to the target cluster. A target difficulty of the target blockchain node is determined according to the node power and reward and the target difficulty weighting. A block is generated after the blockchain calculations are processed according to the target difficulty, the method improves decentralization of the blockchain.

FIELD

The present application relates to a technical field of blockchain, andmore particularly to a block operation method, an electronic device, anda storage medium.

BACKGROUND

In blockchaining, blockchain nodes with high operating power cancomplete operating tasks more quickly, effectively leading to a monopolyon blockchain operations by such nodes and receipt of rewards by suchblockchain nodes. Decentralization, the core principle of blockchaining,is thus reduced.

Therefore, it is important to improve the decentralization of theblockchain.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a flowchart diagram of a block operation method in anembodiment of the present application.

FIG. 2 is a structural diagram of a block operation device in anembodiment of the present application.

FIG. 3 is a structural diagram of an electronic device in an embodimentof the present application.

DETAILED DESCRIPTION

The accompanying drawings combined with the detailed descriptionillustrate the embodiments of the present disclosure hereinafter. It isnoted that embodiments of the present disclosure and features of theembodiments can be combined, when there is no conflict.

Various details are described in the following descriptions for a betterunderstanding of the present disclosure, however, the present disclosuremay also be implemented in other ways other than those described herein.The scope of the present disclosure is not to be limited by the specificembodiments disclosed below. Unless defined otherwise, all technical andscientific terms used herein have the same meaning as commonlyunderstood by one of ordinary skill in the art to which the presentdisclosure belongs. The terms used herein in the present disclosure areonly for the purpose of describing specific embodiments and are notintended to limit the present disclosure.

FIG. 1 is a flowchart diagram of a block operation method in anembodiment of the present application.

In one embodiment, the block operation method may be applied to one ormore electronic devices 1. The electronic device 3 includes hardwaresuch as, but is not limited to, a microprocessor and an ApplicationSpecific Integrated Circuit (ASIC), a Field-Programmable Gate Array(FPGA), a Digital Signal Processor (DSP), embedded devices, for example.

The electronic device 3 may be any electronic product that can interactwith a user, such as a personal computer, a tablet computer, a smartphone, a personal digital assistant (Personal Digital Assistant, PDA), agame console, an interactive network television (Internet ProtocolTelevision, IPTV), or smart wearable device, for example.

The electronic device 3 may also include a network device and/or a userdevice. The network device includes, but is not limited to, a singlenetwork server, a server group including multiple network servers, or acloud including a large quantity of hosts or network servers based on acloud computing technology.

A network can include, but is not limited to, the Internet, a wide areanetwork, a metropolitan area network, a local area network, and avirtual private network (Virtual Private Network, VPN), for example.

In block S11, the electronic device 3 performs an average clusteringprocessing of a plurality of blockchain nodes according to a computingpower and rewards of each of the plurality of blockchain nodes, andobtains a plurality of clusters.

In one embodiment, the computing power (e.g., hash rate) is ameasurement unit of a processing power of a bitcoin network. It is aspeed at which the computer calculates an output of a hash function. Thebitcoin network can perform intensive mathematical andencryption-related operations for security purposes. For example, inrespond that the bitcoin network reaches a hash rate of 10 Th/s, thisrepresents a performance of 10 trillion calculations per second. Thecomputing power may be a data operating capability of the blockchainnode, and the rewards refers to rewards obtained according to a presetreward mechanism in response to the blockchain node completing thecomputing task.

In one embodiment, the average clustering processing may refer to ak-means clustering algorithm, which is an iterative solution clusteringanalysis algorithm. The average clustering processing may include:dividing data into K groups in advance, then randomly selecting Kobjects as cluster centers, and calculating a distance between eachobject and each seed cluster center, and assigning each object to acluster center that is closest to the object. The cluster centers andthe objects assigned to the cluster centers themselves form a cluster.Each time a sample is allocated, the cluster centers of the cluster willbe recalculated based on the existing objects in the cluster. Thisprocess is repeated until a specified termination condition is met. Thetermination condition can be that no cluster center changes again orthat a predetermined minimum number of cluster centers changes.

A cluster can include a plurality of blockchain nodes, and a blockchainnode can merely belong to one cluster.

In one embodiment, before performing an average clustering processing ofa plurality of blockchain nodes according to a computing power andrewards of each of the blockchain nodes, and obtaining a plurality ofclusters, the electronic device 3 obtains the computing power andrewards of each of the blockchain nodes. The electronic device 3 mapseach of the blockchain nodes to a two dimensional (2D) coordinate systemaccording to the computing power and rewards of each of the blockchainnodes, and coordinates are obtained corresponding to the each of theblockchain nodes. The computing power of each of the blockchain nodes isindicated by an abscissa, and the rewards of each of the blockchainnodes are indicated by an ordinate.

Moreover, the blockchain nodes correspond to the plurality ofcoordinates. The computing power of the blockchain nodes is theabscissa, and the rewards of the blockchain is the ordinate. Forexample, assuming that a quantized computing power of a blockchain nodeis 10, and a quantized reward is 15, the corresponding coordinates ofthe blockchain node are (10, 15).

Specifically, the coordinates corresponding to the each of theblockchain nodes are determined according to the computing power and therewards of each of the blockchain nodes, an initial center point isdetermined from the coordinates. The coordinates are grouped accordingto the initial center point, and a plurality of initial groups areobtained. A first center point is obtained by recalculating centers ofthe plurality of initial groups. In response that the first center pointis consistent with the initial center point, the average clusteringprocessing is determined to be completed, and the initial groups aredetermined as the plurality of clusters.

In one embodiment, the coordinates corresponding to each blockchain nodecan be determined according to the computing power and the rewards ofeach blockchain node, such as coordinates (10, 10), (10, 15), (15, 10),for example. That is, each blockchain node has correspondingcoordinates. One or more initial center points can be determined. Forexample, the initial center points have coordinates, such as (5, 5),(10, 10), for example. Based on the one or more initial center points,the blockchain nodes can be grouped by calculating a distance betweeneach of the blockchain nodes and one of the initial center points. Ablockchain node is allocated to a corresponding initial center point,which is closest to the blockchain node. Specifically, the distance canbe calculated according to coordinates of the blockchain node and eachof the initial center points, thereby determining the correspondinginitial center point which is closest to the blockchain node. Byrepeating above allocation process, all of the blockchain nodes can beallocated. Thus, each initial center point corresponds to one or moreblockchain nodes, and an initial group is obtained. Each initial groupincludes one or more blockchain nodes, which are allocated to a sameinitial center point. A first center point is obtained by recalculatingcenters of the initial groups. In response that the first center pointis consistent with the initial center point, the average clusteringprocessing is determined to be completed, and the initial groups aredetermined to be the clusters.

In one embodiment, in response that the first center point isinconsistent with the initial center point, the electronic device 3regroups the coordinates according to the first center point, andobtains a plurality of first groups. The electronic device 3 calculatesa plurality of second center points of the plurality of first groups. Inresponse that the second center point is consistent with the firstcenter point, the electronic device 3 determines that the averageclustering processing is completed, and determines the first groups asbeing the clusters.

In response that the first center point is inconsistent with the initialcenter point, the electronic device 3 determines that the averageclustering processing is not completed, the coordinates are regroupedaccording to the first center point, and the first groups are obtained.The second center points of the first groups are calculated. In responsethat the first center point is consistent with the initial center point,the electronic device 3 determines that the average clusteringprocessing is completed, and the electronic device 3 determines theinitial groups as the clusters.

In one embodiment, the electronic device 3 determines which node has theshortest distance among calculated distances from an origin of the 2Dcoordinate system to each of the blockchain nodes, and the electronicdevice 3 determines which node has the longest distance from thecalculated distances. The electronic device 3 determines a difference indistance between the shortest and the longest distances. The electronicdevice 3 determines such difference in distance as the preset firstdistance.

For example, the coordinates of the shortest-distance node are (1, 0),and the corresponding calculated distance is 1. The coordinates of thelongest-distance node are (10, 0), and the corresponding calculateddistance is 10. Then the preset first distance is 9.

In block S12, in response that a target blockchain node receives abroadcast block, the electronic device 3 determines a node computingpower and node rewards carried by the broadcast block.

In one embodiment, the broadcast block may be a packaged block after aspecified blockchain node has completed an operation task, and thepackaged block will be broadcast to other blockchain nodes.

The broadcast block carries the computing power and rewards of theblockchain nodes in the package of the broadcast block.

In one embodiment, after the electronic device 3 performs an averageclustering processing of a plurality of blockchain nodes according to acomputing power and rewards of each of the blockchain nodes, obtains aplurality of clusters. In response that a target blockchain nodereceives a broadcast block, the electronic device 3 determines a nodecomputing power and node rewards carried by the broadcast block, theelectronic device 3 determines a center coordinate of each of theclusters. The electronic device 3 determines a third distance betweenthe center coordinate and the origin of the 2D coordinate system. Theelectronic device 3 allocates a difficulty weighting to each of theclusters according to the third distance.

For example, there are 3 clusters, a third distance of cluster A is 1, athird distance of cluster B is 3, and a third distance of cluster C is5. Then the total number of clusters is 3, the third distance of clusterA is less than the third distance of cluster B, and the third distanceof cluster B is less than the third distance of cluster C, then thedifficulty weighting corresponding to the cluster A is 1/3, thedifficulty weighting corresponding to the cluster B is 2/3, and thedifficulty weighting corresponding to the cluster C is 3/3.

In block S13, the electronic device 3 determines a target cluster thatthe target blockchain node is belonged to, from the clusters, anddetermines a target difficulty weighting corresponding to the targetcluster.

In one embodiment, different clusters have different difficultyweightings. A cluster includes at least one blockchain node, and ablockchain node can belong to only one cluster.

In block S14, the electronic device 3 determines a target difficulty ofthe target blockchain node according to the node computing power, thenode rewards, a target computing power and target rewards of the targetblockchain node, and the target difficulty weighting.

In one embodiment, the degree of difficulty can be used to control anaverage generation time of the block. When the difficulty degree ishigher, it is more difficult for the blockchain node to complete theoperation. Conversely, when the difficulty degree is lower, it is easierfor the blockchain node to complete the operation.

Specifically, node coordinates of each of the blockchain nodes aredetermined, the node coordinates corresponding to the node computingpower and the node rewards. Target coordinates corresponding to thetarget computing power and the target rewards of the target blockchainnode are determined. A second distance is calculated between the nodecoordinates and the target coordinates, and a preset first distance isobtained. The target difficulty is determined according to the presetfirst distance, the second distance, and the target difficultyweighting.

For example, a node computing power is 28 and a node reward is 14, thenode coordinates can be (28, 14). A target blockchain node A and atarget blockchain node B receive the broadcast block and verify validityof the broadcast block. For example, a first distance is 30. A seconddistance between the target blockchain node A and the node coordinatesis 15, and the difficulty weighting corresponding to the target clusteris 1. The distance between the target blockchain node B and the nodecoordinates is 15, the difficulty weighting corresponding to the targetcluster is 1/3, and the total number of clusters is 3. The targetdifficulty calculated by the target blockchain node A is(1−15/30)*(1/1)*2²⁵⁶=0.5*2²⁵⁶. The target difficulty calculated by thetarget blockchain node B is (1−15/30)*(1/3)*2²⁵⁶=0.16*2²⁵⁶.

In block S15, the electronic device 3 performs a block operationprocessing according to the target difficulty, and generates a blockafter the block calculations processing.

In one embodiment, all blockchain nodes can process a block(“calculation task”) at the same time. The block operation refers to acalculation task. In respond that a blockchain node completes thecalculation task, a block is generated and added into the blockchain.The computing power and rewards of the blockchain node can be packagedinto the block, and then the packaged block is broadcast to otherblockchain nodes, and other blockchain nodes start the next calculationtask after receiving the solved broadcast block.

In the above embodiments, the operation difficulty can be adjustedaccording to the computing power and rewards of the blockchain nodes, itcan be ensured that the blockchain nodes with low computing power cancomplete the operation and receive rewards. Thus, the decentralizationof the blockchain is improved.

FIG. 2 is a structural diagram of a block operation device in anembodiment of the present application.

As shown in FIG. 2, a block operation device 2 includes a clusteringmodule 201, a determination module 202, an operation module 203, anacquisition module 204, a map module 205, a grouping module 206, and adistribution module 207. The modules in the present application refer toone of a stored series of computer-readable instruction segments thatcan be executed by at least one processor and that are capable ofperforming preset functions. In some embodiments, the functions of eachmodule will be described.

The clustering module 201 performs an average clustering processing of aplurality of blockchain nodes according to a computing power and rewardsof each blockchain node, and obtains a plurality of clusters.

In one embodiment, the computing power (e.g., hash rate) is ameasurement unit of a processing power of a bitcoin network. It is aspeed at which the computer calculates an output of a hash function. Thebitcoin network can perform intensive mathematical andencryption-related operations for security purposes. For example, inrespond that the bitcoin network reaches a hash rate of 10 Th/s, thisindicates a performance of 10 trillion calculations per second. Thecomputing power may be a data operating capability of the blockchainnode, and the rewards refers to rewards obtained according to a presetreward mechanism when the blockchain node completes the computing task.

In one embodiment, the average clustering processing may refer to ak-means clustering algorithm, which is an iterative solution clusteringanalysis algorithm. The average clustering processing may include:dividing data into K groups in advance, then randomly selecting Kobjects as cluster centers, and calculating a distance between eachobject and each seed cluster center, and allocating each object to acluster center that is closest to the object. The cluster centers andthe objects allocated to the cluster centers themselves form a cluster.Each time a sample is allocated, the cluster centers of the cluster willbe recalculated based on the existing objects in the cluster. Thisprocess is repeated until a specified termination condition is met. Thetermination condition can be that no cluster center changes again orthat a predetermined minimum number of cluster centers do change.

A cluster can include a plurality of blockchain nodes, and a blockchainnode merely belongs to one cluster.

In one embodiment, before performing an average clustering processing ofa plurality of blockchain nodes according to a computing power andrewards of each of the blockchain nodes, and obtaining a plurality ofclusters, the acquisition module 204 obtains the computing power andrewards of each of the blockchain nodes. The map module 205 maps each ofthe blockchain nodes to a two dimensional (2D) coordinate systemaccording to the computing power and rewards of each of the blockchainnodes, and coordinates are obtained corresponding to the each of theblockchain nodes. The computing power of each of the blockchain nodes isindicated by an abscissa, and the rewards of each of the blockchainnodes are indicated by an ordinate.

Moreover, the blockchain nodes correspond to the plurality ofcoordinates. The computing power of the blockchain nodes is theabscissa, and the rewards of the blockchain is the ordinate. Forexample, assuming that a quantized computing power of a blockchain nodeis 10, and a quantized reward is 15, the corresponding coordinates ofthe blockchain node are (10, 15).

Specifically, the coordinates corresponding to the each of theblockchain nodes are determined according to the computing power and therewards of each of the blockchain nodes, an initial center point isdetermined from the coordinates. The coordinates are grouped accordingto the initial center point, and a plurality of initial groups areobtained. A first center point is obtained by recalculating centers ofthe plurality of initial groups. In response that the first center pointis consistent with the initial center point, the average clusteringprocessing is determined to be completed, and the initial groups aredetermined as the plurality of clusters.

In one embodiment, the coordinates corresponding to each blockchain nodecan be determined according to the computing power and the rewards ofeach blockchain node, such as coordinates (10, 10), (10, 15), (15, 10),for example. That is, each blockchain node has correspondingcoordinates. One or more initial center points can be determined. Forexample, the initial center points have coordinates, such as (5, 5),(10, 10), for example. Based on the one or more initial center points,the blockchain nodes can be grouped by calculating a distance betweeneach of the blockchain nodes and one of the initial center points. Ablockchain node is allocated to a corresponding initial center point,which is closest to the blockchain node. Specifically, the distance canbe calculated according to coordinates of the blockchain node and eachof the initial center points, thereby determining the correspondinginitial center point, which is closest to the blockchain node. Byrepeating above allocation process, all of the blockchain nodes can beallocated. Thus, each initial center point corresponds to one or moreblockchain nodes, and an initial groups is obtained. Each initial groupincludes one or more blockchain nodes, which are allocated to a sameinitial center point. A first center point is obtained by recalculatingcenters of the initial groups. In response that the first center pointis consistent with the initial center point, the average clusteringprocessing is determined to be completed, and the initial groups aredetermined to be the clusters.

In one embodiment, in response that the first center point isinconsistent with the initial center point, the grouping module 206regroups the coordinates according to the first center point, andobtains a plurality of first groups. The operation module 203 calculatesa plurality of second center points of the plurality of first groups. Inresponse that the second center point is consistent with the firstcenter point, the determination module 202 determines that the averageclustering processing is completed, and determines the first groups asbeing the clusters.

In response that the first center point is inconsistent with the initialcenter point, the determination module 202 determines that the averageclustering processing is not completed, the coordinates are regroupedaccording to the first center point, and the first groups are obtained.The second center points of the first groups are calculated. In responsethat the first center point is consistent with the initial center point,the determination module 202 determines that the average clusteringprocessing is completed, and the determination module 202 determines theinitial groups as the clusters.

In one embodiment, the determination module 202 determines t which nodehas the shortest distance among calculated distances from an origin ofthe 2D coordinate system to each of the blockchain nodes, and thedetermination module 202 determines which node has the longest distancefrom the calculated distances. The determination module 202 determines adifference in distance between the shortest and the longest distances.The determination module 202 determines such difference in distance asthe preset first distance.

For example, the coordinates of the shortest-distance node are (1, 0),and the corresponding calculated distance is 1. The coordinates of thelongest-distance node are (10, 0), and the corresponding calculateddistance is 10. Then the preset first distance is 9.

In response that a target blockchain node receives a broadcast block,the determination module 202 determines a node computing power and noderewards carried by the broadcast block.

In one embodiment, the broadcast block may be a packaged block after aspecified blockchain node has completed an operation task, and thepackaged block will be broadcast to other blockchain nodes.

The broadcast block carries the computing power and rewards of theblockchain nodes in the package of the broadcast block.

In one embodiment, after the clustering module 201 performs an averageclustering processing of a plurality of blockchain nodes according to acomputing power and rewards of each of the blockchain nodes, obtains aplurality of clusters. In response that a target blockchain nodereceives a broadcast block, the determination module 202 determines anode computing power and node rewards carried by the broadcast block,the determination module 202 determines a center coordinate of each ofthe clusters. The determination module 202 determines a third distancebetween the center coordinate and the origin of the 2D coordinatesystem. The distribution module 207 allocates a difficulty weighting toeach of the clusters according to the third distance.

For example, there are 3 clusters, a third distance of cluster A is 1, athird distance of cluster B is 3, and a third distance of cluster C is5. Then the total number of clusters is 3, the third distance of clusterA is less than the third distance of cluster B, and the third distanceof cluster B is less than the third distance of cluster C, then thedifficulty weighting corresponding to the cluster A is 1/3, thedifficulty weighting corresponding to the cluster B is 2/3, and thedifficulty weighting corresponding to the cluster C is 3/3.

The determination module 202 determines a target cluster that the targetblockchain node is belonged to, from the clusters, and determines atarget difficulty weighting corresponding to the target cluster.

In one embodiment, different clusters have different difficultyweightings. A cluster includes at least one blockchain node, and ablockchain node can belong to only one cluster.

The determination module 202 determines a target difficulty of thetarget blockchain node according to the node computing power, the noderewards, a target computing power and target rewards of the targetblockchain node, and the target difficulty weighting.

In one embodiment, the degree of difficulty can be used to control anaverage generation time of the block. When the difficulty degree ishigher, it is more difficult for the blockchain node to complete theoperation. Conversely, when the difficulty degree is lower, it is easierfor the blockchain node to complete the operation.

Specifically, node coordinates of each of the blockchain nodes aredetermined, the node coordinates corresponding to the node computingpower and the node rewards. Target coordinates corresponding to thetarget computing power and the target rewards of the target blockchainnode are determined. A second distance is calculated between the nodecoordinates and the target coordinates, and a preset first distance isobtained. The target difficulty is determined according to the presetfirst distance, the second distance, and the target difficultyweighting.

For example, a node computing power is 28 and a node reward is 14, thenode coordinates can be (28, 14). A target blockchain node A and atarget blockchain node B receive the broadcast block and verify validityof the broadcast block. For example, a first distance is 30. A seconddistance between the target blockchain node A and the node coordinatesis 15, and the difficulty weighting corresponding to the target clusteris 1. The distance between the target blockchain node B and the nodecoordinates is 15, the difficulty weighting corresponding to the targetcluster is 1/3, and the total number of clusters is 3. The targetdifficulty calculated by the target blockchain node A is(1−15/30)*(1/1)*2²⁵⁶=0.5*2²⁵⁶. The target difficulty calculated by thetarget blockchain node B is (1−15/30)*(1/3)*2²⁵⁶=0.16*2²⁵⁶.

The operation module 203 performs a block operation processing accordingto the target difficulty, and generates a block after the blockcalculations processing.

In one embodiment, all blockchain nodes can process a block(“calculation task”) at the same time. The block operation refers to acalculation task. In respond that a blockchain node completes thecalculation task, a block is generated and added into the blockchain.The computing power and rewards of the blockchain node can be packagedinto the block, and then the packaged block is broadcast to otherblockchain nodes, and other blockchain nodes starts the next calculationtask after receiving the solved broadcast block.

In the above embodiments, the operation difficulty can be adjustedaccording to the computing power and rewards of the blockchain nodes, itcan be ensured that the blockchain nodes with low computing power cancomplete the operation and receive rewards. Thus, the decentralizationof the blockchain is improved.

FIG. 3 is a structural diagram of an electronic device in an embodimentof the present application. The electronic device 3 may include astorage device 31, at least one processor 32, and computer-readableinstructions stored in the storage device 31 and executable by the atleast one processor 32, for example, a growth height of a plantdetermination programs.

Those skilled in the art will understand that FIG. 3 is only an exampleof the electronic device 3 and does not constitute a limitation on theelectronic device 3. Another electronic device 3 may include more orfewer components than shown in the figures or may combine somecomponents or have different components. For example, the electronicdevice 3 may further include an input/output device, a network accessdevice, a bus, and the like.

The at least one processor 32 can be a central processing unit (CPU), orcan be another general-purpose processor, digital signal processor(DSPs), application-specific integrated circuit (ASIC),Field-Programmable Gate Array (FPGA), another programmable logic device,discrete gate, transistor logic device, or discrete hardware component,etc. The processor 32 can be a microprocessor or any conventionalprocessor. The processor 32 is a control center of the electronic device3 and connects various parts of the entire electronic device 3 by usingvarious interfaces and lines.

The processor 32 executes the computer-readable instructions toimplement the block operation method in the above embodiments, such asin block S11-S15 shown in FIG. 1. Alternatively, the processor 32executes the computer-readable instructions to implement the functionsof the modules/units in the foregoing device embodiments, such as themodules 201-207 in FIG. 2.

For example, the computer-readable instructions can be divided into oneor more modules/units, and the one or more modules/units are stored inthe storage device 31 and executed by the at least one processor 32. Theone or more modules/units can be a series of computer-readableinstruction segments capable of performing specific functions, and theinstruction segments are used to describe execution processes of thecomputer-readable instructions in the electronic device 3. For example,the computer-readable instruction can be divided into the clusteringmodule 201, the determination module 202, the operation module 203, theacquisition module 204, the map module 205, the grouping module 206, andthe distribution module 207 as shown in FIG. 2.

The storage device 31 can be configured to store the computer-readableinstructions and/or modules/units. The processor 32 may run or executethe computer-readable instructions and/or modules/units stored in thestorage device 31 and may call up data stored in the storage device 31to implement various functions of the electronic device 3. The storagedevice 31 mainly includes a storage program area and a storage dataarea. The storage program area may store an operating system, and anapplication program required for at least one function (such as a soundplayback function, an image playback function, for example), forexample. The storage data area may store data (such as audio data, phonebook data, for example) created during the use of the electronic device3. In addition, the storage device 31 may include a high-speed randomaccess memory, and may also include a non-transitory storage medium,such as a hard disk, an internal memory, a plug-in hard disk, a smartmedia card (SMC), a secure digital (SD) Card, a flashcard, at least onedisk storage device, a flash memory device, or another non-transitorysolid-state storage device.

The storage device 31 may be an external memory and/or an internalmemory of the electronic device 3. The storage device 31 may be a memoryin a physical form, such as a memory stick, a Trans-flash Card (TFcard), for example.

When the modules/units integrated into the electronic device 3 areimplemented in the form of software functional units having been sold orused as independent products, they can be stored in a non-transitoryreadable storage medium. Based on this understanding, all or part of theprocesses in the methods of the above embodiments implemented by thepresent disclosure can also be completed by related hardware instructedby computer-readable instructions. The computer-readable instructionscan be stored in a non-transitory readable storage medium. Thecomputer-readable instructions, when executed by the processor, mayimplement the steps of the foregoing method embodiments. Thecomputer-readable instructions include computer-readable instructioncodes, and the computer-readable instruction codes can be in a sourcecode form, an object code form, an executable file, or some intermediateform. The non-transitory readable storage medium can include any entityor device capable of carrying the computer-readable instruction code,such as a recording medium, a U disk, a mobile hard disk, a magneticdisk, an optical disk, a computer memory, or a read-only memory (ROM).

With reference to FIG. 1, the storage device 31 in the electronic device3 stores a plurality of instructions to implement a block operationmethod, and the processor 32 can execute the multiple instructions to:perform an average clustering processing of a plurality of blockchainnodes according to a computing power and rewards of each of theplurality of blockchain nodes, and obtain a plurality of clusters; inresponse that a target blockchain node receives a broadcast block,determine a node computing power and node rewards carried by thebroadcast block; determine a target cluster that the target blockchainnode is belonged to, from the plurality of clusters, and determine atarget difficulty weighting corresponding to the target cluster;determine a target difficulty of the target blockchain node according tothe node computing power, the node rewards, a target computing power andtarget rewards of the target blockchain node and the target difficultyweighting; perform a block operation processing according to the targetdifficulty, and generate a block after the block calculationsprocessing.

The computer-readable instructions are executed by the processor 32 torealize the functions of each module/unit in the above-mentioned deviceembodiments, which will not be repeated here.

In the several embodiments provided in the preset application, thedisclosed electronic device and method can be implemented in other ways.For example, the embodiments of the devices described above are merelyillustrative. For example, divisions of the modules are based on logicalfunction only, and there can be other manners of division in actualimplementation.

In addition, each functional module in each embodiment of the presentdisclosure can be integrated into one processing module, or can bephysically present separately in each unit or two or more modules can beintegrated into one module. The above modules can be implemented in aform of hardware or in a form of a software functional unit.

Therefore, the present embodiments are considered as illustrative andnot restrictive, and the scope of the present disclosure is defined bythe appended claims. All changes and variations in the meaning and scopeof equivalent elements are included in the present disclosure. Anyreference sign in the claims should not be construed as limiting theclaim.

Moreover, the word “comprising” does not exclude other units nor doesthe singular exclude the plural. A plurality of units or devices statedin the system claims may also be implemented by one unit or devicethrough software or hardware. Words such as “first” and “second” areused to indicate names, but not in any particular order.

Finally, the above embodiments are only used to illustrate technicalsolutions of the present disclosure and are not to be taken asrestrictions on the technical solutions. Although the present disclosurehas been described in detail with reference to the above embodiments,those skilled in the art should understand that the technical solutionsdescribed in one embodiment can be modified, or some of the technicalfeatures can be equivalently substituted, and that these modificationsor substitutions are not to detract from the essence of the technicalsolutions or from the scope of the technical solutions of theembodiments of the present disclosure.

What is claimed is:
 1. A block operation method, the method comprising:performing an average clustering processing of a plurality of blockchainnodes according to a computing power and rewards of each of theplurality of blockchain nodes, and obtaining a plurality of clusters; inresponse that a target blockchain node receives a broadcast block,determining a node computing power and node rewards carried by thebroadcast block; determining a target cluster that the target blockchainnode is belonged to, from the plurality of clusters, and determining atarget difficulty weighting corresponding to the target cluster;determining a target difficulty of the target blockchain node accordingto the node computing power, the node rewards, a target computing powerand target rewards of the target blockchain node and the targetdifficulty weighting; performing a block operation processing accordingto the target difficulty, and generating a block after the blockcalculations processing.
 2. The block operation method of claim 1,before performing an average clustering processing of a plurality ofblockchain nodes according to a computing power and rewards of each ofthe plurality of blockchain nodes, and obtaining a plurality ofclusters, further comprising: obtaining the computing power and rewardsof each of the plurality of blockchain nodes; mapping each of theplurality of blockchain nodes to a two dimensional (2D) coordinatesystem according to the computing power and rewards of each of theplurality of blockchain nodes, and obtaining coordinates correspondingto the each of the plurality of blockchain nodes, wherein the computingpower of each of plurality of the blockchain nodes is an abscissa, andthe rewards of each of the plurality of blockchain nodes is an ordinate.3. The block operation method of claim 2, wherein determining a targetdifficulty of the target blockchain node according to the node computingpower, the node rewards, a target computing power and target rewards ofthe target blockchain node and the target difficulty weightingcomprises: determining node coordinates of each of the plurality ofblockchain nodes, the node coordinates corresponding to the nodecomputing power and the node rewards; determining target coordinatescorresponding to the target computing power and the target rewards ofthe target blockchain node; calculating a second distance between thenode coordinates and the target coordinates; obtaining a preset firstdistance; determining the target difficulty according to the presetfirst distance, the second distance, and the target difficultyweighting.
 4. The block operation method of claim 3, before performingan average clustering processing of a plurality of blockchain nodesaccording to a computing power and rewards of each of the plurality ofblockchain nodes, and obtaining a plurality of clusters, furthercomprising: determining the smallest node with the smallest distanceamong calculated distances from an origin of the 2D coordinate system toeach of the plurality of blockchain nodes, and determining the largestnode with the largest distance from the calculated distances;determining a distance difference between the smallest distance and thelargest distance; determining the distance difference as the presetfirst distance.
 5. The block operation method of claim 2, afterperforming an average clustering processing of a plurality of blockchainnodes according to a computing power and rewards of each of theplurality of blockchain nodes, and obtaining a plurality of clusters,and before in response that a target blockchain node receives abroadcast block, determining a node computing power and node rewardscarried by the broadcast block, further comprising: determining a centercoordinate of each of the plurality of clusters; determining a thirddistance between the center coordinate and the origin of the 2Dcoordinate system; allocating a difficulty weighting to each of theplurality of clusters according to the third distance.
 6. The blockoperation method of claim 1, wherein performing an average clusteringprocessing of a plurality of blockchain nodes according to a computingpower and rewards of each of the plurality of blockchain nodes, andobtaining a plurality of clusters comprises: determining a plurality ofcoordinates corresponding to the each of the plurality of blockchainnodes according to the computing power and the rewards of each of theplurality of blockchain nodes; determining an initial center point fromthe plurality of coordinates; grouping the plurality of coordinatesaccording to the initial center point, and obtaining a plurality ofinitial groups; recalculating centers of the plurality of initialgroups, and obtaining a first center point; in response that the firstcenter point is consistent with the initial center point, determiningthat the average clustering processing is completed, and determining theplurality of initial groups as the plurality of clusters.
 7. The blockoperation method of claim 6, the method further comprising: in responsethat the first center point is inconsistent with the initial centerpoint, regrouping the plurality of coordinates according to the firstcenter point, and obtaining a plurality of first groups; calculating aplurality of second center points of the plurality of first groups; inresponse that the second center point is consistent with the firstcenter point, determining that the average clustering processing iscompleted, and determining the plurality of first groups as theplurality of clusters.
 8. An electronic device comprising: a processor;and a storage device storing a plurality of instructions, which whenexecuted by the processor, cause the processor to: perform an averageclustering processing of a plurality of blockchain nodes according to acomputing power and rewards of each of the plurality of blockchainnodes, and obtain a plurality of clusters; in response that a targetblockchain node receives a broadcast block, determine a node computingpower and node rewards carried by the broadcast block; determine atarget cluster that the target blockchain node is belonged to, from theplurality of clusters, and determine a target difficulty weightingcorresponding to the target cluster; determine a target difficulty ofthe target blockchain node according to the node computing power, thenode rewards, a target computing power and target rewards of the targetblockchain node and the target difficulty weighting; perform a blockoperation processing according to the target difficulty, and generate ablock after the block calculations processing.
 9. The electronic deviceof claim 8, wherein the processor is further caused to: obtain thecomputing power and rewards of each of the plurality of blockchainnodes; map each of the plurality of blockchain nodes to a twodimensional (2D) coordinate system according to the computing power andrewards of each of the plurality of blockchain nodes, and obtaincoordinates corresponding to the each of the plurality of blockchainnodes, wherein the computing power of each of plurality of theblockchain nodes is an abscissa, and the rewards of each of theplurality of blockchain nodes is an ordinate.
 10. The electronic deviceof claim 9, wherein the processor is further caused to: determine nodecoordinates of each of the plurality of blockchain nodes, the nodecoordinates corresponding to the node computing power and the noderewards; determine target coordinates corresponding to the targetcomputing power and the target rewards of the target blockchain node;calculate a second distance between the node coordinates and the targetcoordinates; obtain a preset first distance; determine the targetdifficulty according to the preset first distance, the second distance,and the target difficulty weighting.
 11. The electronic device of claim10, wherein the processor is further caused to: determine the smallestnode with the smallest distance among calculated distances from anorigin of the 2D coordinate system to each of the plurality ofblockchain nodes, and determine the largest node with the largestdistance from the calculated distances; determine a distance differencebetween the smallest distance and the largest distance; determine thedistance difference as the preset first distance.
 12. The electronicdevice of claim 9, wherein the processor is further caused to: determinea center coordinate of each of the plurality of clusters; determine athird distance between the center coordinate and the origin of the 2Dcoordinate system; allocate a difficulty weighting to each of theplurality of clusters according to the third distance.
 13. Theelectronic device of claim 8, wherein the processor is further causedto: determine a plurality of coordinates corresponding to the each ofthe plurality of blockchain nodes according to the computing power andthe rewards of each of the plurality of blockchain nodes; determine aninitial center point from the plurality of coordinates; group theplurality of coordinates according to the initial center point, andobtain a plurality of initial groups; recalculate centers of theplurality of initial groups, and obtain a first center point; inresponse that the first center point is consistent with the initialcenter point, determine that the average clustering processing iscompleted, and determine the plurality of initial groups as theplurality of clusters.
 14. The electronic device of claim 13, whereinthe processor is further caused to: in response that the first centerpoint is inconsistent with the initial center point, regroup theplurality of coordinates according to the first center point, and obtaina plurality of first groups; calculate a plurality of second centerpoints of the plurality of first groups; in response that the secondcenter point is consistent with the first center point, determine thatthe average clustering processing is completed, and determine theplurality of first groups as the plurality of clusters.
 15. Anon-transitory storage medium having stored thereon at least onecomputer-readable instructions that, when executed by a processor of anelectronic device, causes the processor to perform a block operationmethod, the method comprising: performing an average clusteringprocessing of a plurality of blockchain nodes according to a computingpower and rewards of each of the plurality of blockchain nodes, andobtaining a plurality of clusters; in response that a target blockchainnode receives a broadcast block, determining a node computing power andnode rewards carried by the broadcast block; determining a targetcluster that the target blockchain node is belonged to, from theplurality of clusters, and determining a target difficulty weightingcorresponding to the target cluster; determining a target difficulty ofthe target blockchain node according to the node computing power, thenode rewards, a target computing power and target rewards of the targetblockchain node and the target difficulty weighting; performing a blockoperation processing according to the target difficulty, and generatinga block after the block calculations processing.
 16. The non-transitorystorage medium of claim 15, before performing an average clusteringprocessing of a plurality of blockchain nodes according to a computingpower and rewards of each of the plurality of blockchain nodes, andobtaining a plurality of clusters, wherein the method further comprises:obtaining the computing power and rewards of each of the plurality ofblockchain nodes; mapping each of the plurality of blockchain nodes to atwo dimensional (2D) coordinate system according to the computing powerand rewards of each of the plurality of blockchain nodes, and obtainingcoordinates corresponding to the each of the plurality of blockchainnodes, wherein the computing power of each of plurality of theblockchain nodes is an abscissa, and the rewards of each of theplurality of blockchain nodes is an ordinate.
 17. The non-transitorystorage medium of claim 16, wherein determining a target difficulty ofthe target blockchain node according to the node computing power, thenode rewards, a target computing power and target rewards of the targetblockchain node and the target difficulty weighting comprises:determining node coordinates of each of the plurality of blockchainnodes, the node coordinates corresponding to the node computing powerand the node rewards; determining target coordinates corresponding tothe target computing power and the target rewards of the targetblockchain node; calculating a second distance between the nodecoordinates and the target coordinates; obtaining a preset firstdistance; determining the target difficulty according to the presetfirst distance, the second distance, and the target difficultyweighting.
 18. The non-transitory storage medium of claim 17, beforeperforming an average clustering processing of a plurality of blockchainnodes according to a computing power and rewards of each of theplurality of blockchain nodes, and obtaining a plurality of clusters,wherein the method further comprises: determining the smallest node withthe smallest distance among calculated distances from an origin of the2D coordinate system to each of the plurality of blockchain nodes, anddetermining the largest node with the largest distance from thecalculated distances; determining a distance difference between thesmallest distance and the largest distance; determining the distancedifference as the preset first distance.
 19. The non-transitory storagemedium of claim 16, after performing an average clustering processing ofa plurality of blockchain nodes according to a computing power andrewards of each of the plurality of blockchain nodes, and obtaining aplurality of clusters, and before in response that a target blockchainnode receives a broadcast block, determining a node computing power andnode rewards carried by the broadcast block, wherein the method furthercomprises: determining a center coordinate of each of the plurality ofclusters; determining a third distance between the center coordinate andthe origin of the 2D coordinate system; allocating a difficultyweighting to each of the plurality of clusters according to the thirddistance.
 20. The non-transitory storage medium of claim 15, whereinperforming an average clustering processing of a plurality of blockchainnodes according to a computing power and rewards of each of theplurality of blockchain nodes, and obtaining a plurality of clusterscomprises: determining a plurality of coordinates corresponding to theeach of the plurality of blockchain nodes according to the computingpower and the rewards of each of the plurality of blockchain nodes;determining an initial center point from the plurality of coordinates;grouping the plurality of coordinates according to the initial centerpoint, and obtaining a plurality of initial groups; recalculatingcenters of the plurality of initial groups, and obtaining a first centerpoint; in response that the first center point is consistent with theinitial center point, determining that the average clustering processingis completed, and determining the plurality of initial groups as theplurality of clusters.